

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>控制命令 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="Ceph 社区" href="../../troubleshooting/community/" />
    <link rel="prev" title="迁移到 BlueStore" href="../bluestore-migration/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 存储集群</a></li>
          <li class="breadcrumb-item"><a href="../">集群运维</a></li>
      <li class="breadcrumb-item active">控制命令</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/rados/operations/control.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../configuration/">配置</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">运维</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../operating/">操纵集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-checks/">健康检查</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">监控集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring-osd-pg/">监控 OSD 和归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../user-management/">用户管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pgcalc/">PG Calc</a></li>
<li class="toctree-l3"><a class="reference internal" href="../data-placement/">数据归置概览</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pools/">存储池</a></li>
<li class="toctree-l3"><a class="reference internal" href="../erasure-code/">纠删码</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-tiering/">分级缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../placement-groups/">归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upmap/">使用 pg-upmap</a></li>
<li class="toctree-l3"><a class="reference internal" href="../read-balancer/">Operating the Read (Primary) Balancer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../balancer/">均衡器模块</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map/">CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map-edits/">手动编辑一个 CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stretch-mode/">Stretch Clusters</a></li>
<li class="toctree-l3"><a class="reference internal" href="../change-mon-elections/">Configuring Monitor Election Strategies</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-osds/">增加/删除 OSD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-mons/">增加/删除监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../devices/">设备管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-migration/">迁移到 BlueStore</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">命令参考</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id2">监视器命令</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">系统命令</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">认证子系统</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">归置组子系统</a></li>
<li class="toctree-l4"><a class="reference internal" href="#osd">OSD 子系统</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mds">MDS 子系统</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id7">监视器子系统</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/community/">Ceph 社区</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-mon/">监视器故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-osd/">OSD 故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-pg/">归置组排障</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/log-and-debug/">日志记录和调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/cpu-profiling/">CPU 剖析</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/memory-profiling/">内存剖析</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="index-0">
<span id="id1"></span><h1>控制命令<a class="headerlink" href="#index-0" title="Permalink to this heading"></a></h1>
<section id="id2">
<h2>监视器命令<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>监视器命令用 <code class="docutils literal notranslate"><span class="pre">ceph</span></code> 工具发出：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "$ ";
}
</style><span class="prompt1">ceph<span class="w"> </span><span class="o">[</span>-m<span class="w"> </span>monhost<span class="o">]</span><span class="w"> </span><span class="o">{</span>command<span class="o">}</span></span>
</pre></div></div><p>大多数情况下，命令格式如下：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span><span class="o">{</span>subsystem<span class="o">}</span><span class="w"> </span><span class="o">{</span>command<span class="o">}</span></span>
</pre></div></div></section>
<section id="id3">
<h2>系统命令<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p>下列命令显示当前的集群状态：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>-s</span>
<span class="prompt1">ceph<span class="w"> </span>status</span>
</pre></div></div><p>下列命令显示集群状态的运行概况、及主要事件：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>-w</span>
</pre></div></div><p>查看监视器法定人数状态，包括哪些监视器参与着、哪个是首领，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mon<span class="w"> </span>stat</span>
<span class="prompt1">ceph<span class="w"> </span>quorum_status</span>
</pre></div></div><p>查询单个监视器的状态，包括是否在法定人数里，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>mon.<span class="o">[</span>id<span class="o">]</span><span class="w"> </span>mon_status</span>
</pre></div></div><p>其中， <code class="docutils literal notranslate"><span class="pre">[id]</span></code> 的值可以在 <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">-s</span></code> 的输出里找到。</p>
</section>
<section id="id4">
<h2>认证子系统<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<p>要添加一个 OSD 的密钥环，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>auth<span class="w"> </span>add<span class="w"> </span><span class="o">{</span>osd<span class="o">}</span><span class="w"> </span><span class="o">{</span>--in-file<span class="p">|</span>-i<span class="o">}</span><span class="w"> </span><span class="o">{</span>path-to-osd-keyring<span class="o">}</span></span>
</pre></div></div><p>要列出集群的密钥及其能力，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>auth<span class="w"> </span>ls</span>
</pre></div></div></section>
<section id="id5">
<h2>归置组子系统<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h2>
<p>要显示所有归置组的统计信息，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>pg<span class="w"> </span>dump<span class="w"> </span><span class="o">[</span>--format<span class="w"> </span><span class="o">{</span>format<span class="o">}]</span></span>
</pre></div></div><p>可用输出格式有 <code class="docutils literal notranslate"><span class="pre">plain</span></code> （默认）、 <code class="docutils literal notranslate"><span class="pre">json</span></code> 、 <code class="docutils literal notranslate"><span class="pre">json-pretty</span></code> 、
<code class="docutils literal notranslate"><span class="pre">xml</span></code> 和 <code class="docutils literal notranslate"><span class="pre">xml-pretty</span></code> 。实现监视器和其它工具时，
最好用 <code class="docutils literal notranslate"><span class="pre">json</span></code> 格式。 JSON 格式分析起来比给人看的文本 <code class="docutils literal notranslate"><span class="pre">plain</span></code> 格式更具确定性，
Ceph 版本更迭时它的布局变化少得多。
从 JSON 输出中提取数据可以用 <code class="docutils literal notranslate"><span class="pre">jq</span></code> 工具。</p>
<p>要显示卡在某状态的所有归置组，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>pg<span class="w"> </span>dump_stuck<span class="w"> </span>inactive<span class="p">|</span>unclean<span class="p">|</span>stale<span class="p">|</span>undersized<span class="p">|</span>degraded<span class="w"> </span><span class="o">[</span>--format<span class="w"> </span><span class="o">{</span>format<span class="o">}]</span><span class="w"> </span><span class="o">[</span>-t<span class="p">|</span>--threshold<span class="w"> </span><span class="o">{</span>seconds<span class="o">}]</span></span>
</pre></div></div><p><code class="docutils literal notranslate"><span class="pre">--format</span></code> 可以是 <code class="docutils literal notranslate"><span class="pre">plain</span></code> （默认）、 <code class="docutils literal notranslate"><span class="pre">json</span></code> 、
<code class="docutils literal notranslate"><span class="pre">json-pretty</span></code> 、 <code class="docutils literal notranslate"><span class="pre">xml</span></code> 或 <code class="docutils literal notranslate"><span class="pre">xml-pretty</span></code> 。</p>
<p><code class="docutils literal notranslate"><span class="pre">--threshold</span></code> 定义了多少秒算“卡住了（ <code class="docutils literal notranslate"><span class="pre">stuck</span></code> ）”，默认是 300 秒。</p>
<p>PG 可能卡在下列任何一个状态下：</p>
<p><strong>Inactive</strong></p>
<blockquote>
<div><p>归置组不能处理读或写操作，因为它们在等待持有最新数据的 OSD 回到 <code class="docutils literal notranslate"><span class="pre">up</span></code> 状态。</p>
</div></blockquote>
<p><strong>Unclean</strong></p>
<blockquote>
<div><p>归置组包含副本数未达期望数量的对象，
这些 PG 还没完成恢复进程。</p>
</div></blockquote>
<p><strong>Stale</strong></p>
<blockquote>
<div><p>归置组处于未知状态，相关 OSD 所在的主机有一段时间
（由 <code class="docutils literal notranslate"><span class="pre">mon_osd_report_timeout</span></code> 配置）
没向监视器集群报告了，</p>
</div></blockquote>
<p>要删除“丢失（ <code class="docutils literal notranslate"><span class="pre">lost</span></code> ）”对象，或者把一个对象回退到它先前的状态，
可以是回退到前一个版本、或者删除它，
因为是刚创建的还没有之前的版本，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>pg<span class="w"> </span><span class="o">{</span>pgid<span class="o">}</span><span class="w"> </span>mark_unfound_lost<span class="w"> </span>revert<span class="p">|</span>delete</span>
</pre></div></div></section>
<section id="osd">
<span id="osd-subsystem"></span><h2>OSD 子系统<a class="headerlink" href="#osd" title="Permalink to this heading"></a></h2>
<p>查询 OSD 子系统状态，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>stat</span>
</pre></div></div><p>把最新的 OSD 运行图副本写入一个文件（参见 <a class="reference internal" href="../../../man/8/osdmaptool/#osdmaptool"><span class="std std-ref">osdmaptool</span></a> ），
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>getmap<span class="w"> </span>-o<span class="w"> </span>file</span>
</pre></div></div><p>要把最新 OSD 运行图里的 CRUSH 图写入一个文件，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>getcrushmap<span class="w"> </span>-o<span class="w"> </span>file</span>
</pre></div></div><p>这个命令的功能相当于下面两个命令的：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>getmap<span class="w"> </span>-o<span class="w"> </span>/tmp/osdmap</span>
<span class="prompt1">osdmaptool<span class="w"> </span>/tmp/osdmap<span class="w"> </span>--export-crush<span class="w"> </span>file</span>
</pre></div></div><p>要转储 OSD 运行图，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>dump<span class="w"> </span><span class="o">[</span>--format<span class="w"> </span><span class="o">{</span>format<span class="o">}]</span></span>
</pre></div></div><p><code class="docutils literal notranslate"><span class="pre">--format</span></code> 接受的参数有 <code class="docutils literal notranslate"><span class="pre">plain</span></code> （默认的）、
<code class="docutils literal notranslate"><span class="pre">json</span></code> 、 <code class="docutils literal notranslate"><span class="pre">json-pretty</span></code> 、 <code class="docutils literal notranslate"><span class="pre">xml</span></code> 和 <code class="docutils literal notranslate"><span class="pre">xml-pretty</span></code> 。上文说过，
使用工具、脚本和其他自动化工具解析输出的是，建议用 JSON 格式。</p>
<p>要把 OSD 运行图转储为树，每个 OSD 一行、
显示其权重和 OSD 状态，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>tree<span class="w"> </span><span class="o">[</span>--format<span class="w"> </span><span class="o">{</span>format<span class="o">}]</span></span>
</pre></div></div><p>要找出某个特定的 RADOS 对象存储在系统的哪里，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>map<span class="w"> </span>&lt;pool-name&gt;<span class="w"> </span>&lt;object-name&gt;</span>
</pre></div></div><p>要增加或挪动一个新 OSD （用它的 ID 、名字、或权重指定）到指定的 CRUSH 位置，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>crush<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="o">{</span>id<span class="o">}</span><span class="w"> </span><span class="o">{</span>weight<span class="o">}</span><span class="w"> </span><span class="o">[{</span>loc1<span class="o">}</span><span class="w"> </span><span class="o">[{</span>loc2<span class="o">}</span><span class="w"> </span>...<span class="o">]]</span></span>
</pre></div></div><p>要从 CRUSH 图删除存在的 OSD ，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>crush<span class="w"> </span>remove<span class="w"> </span><span class="o">{</span>name<span class="o">}</span></span>
</pre></div></div><p>要从 CRUSH 图删除存在的桶，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>crush<span class="w"> </span>remove<span class="w"> </span><span class="o">{</span>bucket-name<span class="o">}</span></span>
</pre></div></div><p>把一个存在的桶从 CRUSH 分级结构里的一个位置挪到另一个，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>crush<span class="w"> </span>move<span class="w"> </span><span class="o">{</span>id<span class="o">}</span><span class="w"> </span><span class="o">{</span>loc1<span class="o">}</span><span class="w"> </span><span class="o">[{</span>loc2<span class="o">}</span><span class="w"> </span>...<span class="o">]</span></span>
</pre></div></div><p>设置指定 OSD （用 <code class="docutils literal notranslate"><span class="pre">{name}</span></code> 指定）的 CRUSH 权重为 <code class="docutils literal notranslate"><span class="pre">{weight}</span></code> ，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>crush<span class="w"> </span>reweight<span class="w"> </span><span class="o">{</span>name<span class="o">}</span><span class="w"> </span><span class="o">{</span>weight<span class="o">}</span></span>
</pre></div></div><p>把一个 OSD 标记为丢失（ <code class="docutils literal notranslate"><span class="pre">lost</span></code> ），执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>lost<span class="w"> </span><span class="o">{</span>id<span class="o">}</span><span class="w"> </span><span class="o">[</span>--yes-i-really-mean-it<span class="o">]</span></span>
</pre></div></div><div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>此动作有可能导致数据永久丢失，慎用！</p>
</div>
<p>创建新 OSD ，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>create<span class="w"> </span><span class="o">[{</span>uuid<span class="o">}]</span></span>
</pre></div></div><p>如果执行此命令时没有指定 UUID ，
那么会在 OSD 启动时自动设置 UUID 。</p>
<p>删除一个或多个 OSD ，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>rm<span class="w"> </span><span class="o">[{</span>id<span class="o">}</span>...<span class="o">]</span></span>
</pre></div></div><p>查询 OSD 运行图当前的 <code class="docutils literal notranslate"><span class="pre">max_osd</span></code> 参数，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>getmaxosd</span>
</pre></div></div><p>导入指定的 CRUSH 图，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>setcrushmap<span class="w"> </span>-i<span class="w"> </span>file</span>
</pre></div></div><p>设置 OSD 运行图的 <code class="docutils literal notranslate"><span class="pre">max_osd</span></code> 参数，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>setmaxosd</span>
</pre></div></div><p>这个参数的默认值是 10000 ，
大多数运维人员永远不需要调整它。</p>
<p>把指定的 OSD 标记为 <code class="docutils literal notranslate"><span class="pre">down</span></code> ，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>down<span class="w"> </span><span class="o">{</span>osd-num<span class="o">}</span></span>
</pre></div></div><p>把指定的 OSD 标记为 <code class="docutils literal notranslate"><span class="pre">out</span></code> （这样就不会给它分配数据了），
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>out<span class="w"> </span><span class="o">{</span>osd-num<span class="o">}</span></span>
</pre></div></div><p>把指定的 OSD 标记为 <code class="docutils literal notranslate"><span class="pre">in</span></code> （这样数据就会分配给它），
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">{</span>osd-num<span class="o">}</span></span>
</pre></div></div><p>通过使用 OSD 运行图中的“暂停标志（ pause flag ）”，可以暂停或恢复 I/O 请求。
如果设置了这些标志，则不会向任何 OSD 发送 I/O 请求；
清除标志后，将重新发送待处理的 I/O 请求。
要设置或清除暂停标记，执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pause</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>unpause</span>
</pre></div></div><p>如果常规的 CRUSH 分布看起来不理想，
你可以给指定 OSD 设置覆盖权重或 <code class="docutils literal notranslate"><span class="pre">reweight</span></code> 权重数值。
OSD 的权重有助于确定它能承受的 I/O 请求规模和数据存储量：
权重相同的两个 OSD 大致会收到差不多数量的 I/O 请求、
也会存储差不多数量的数据。 <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">osd</span> <span class="pre">reweight</span></code> 命令可给 OSD 设置一个增益权重，这个权重值的范围在 0 和 1 之间，
它会强迫 CRUSH 重新归置一定数量的（ 1 - <code class="docutils literal notranslate"><span class="pre">weight</span></code> ）、
本应该放到此处的数据。此命令不会影响
CRUSH 图里这个 OSD 之上的桶的权重，使用此命令只是一种纠正措施：
比如，假设你的某个 OSD 使用率达到了 90% ，
但其它的大致都在 50% ，这时你就可以下调这个外在权重来纠正这种不平衡。
要给指定 OSD 设置覆盖权重，
执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>reweight<span class="w"> </span><span class="o">{</span>osd-num<span class="o">}</span><span class="w"> </span><span class="o">{</span>weight<span class="o">}</span></span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>任何指定的覆盖权重值都会与平衡器有冲突。
这意味着，如果正在使用平衡器，所有覆盖权重值都应为 <code class="docutils literal notranslate"><span class="pre">1.0000</span></code> ，
以避免集群出现不太好的行为。</p>
</div>
<p>如果某些 OSD 的利用率过高，为了维持平衡，
可以对集群 OSD 的权重进行调整。注意，
覆盖权重或 <code class="docutils literal notranslate"><span class="pre">reweight</span></code> 权重只是相互之间的相对值（默认是 1.00000 ），
不是绝对值，一定要把它们与 CRUSH 权重区别开来，
CRUSH 权重反映的是一个桶以 TiB 计算的绝对容量。
要按利用率调整 OSD 的权重，执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>reweight-by-utilization<span class="w"> </span><span class="o">[</span>threshold<span class="w"> </span><span class="o">[</span>max_change<span class="w"> </span><span class="o">[</span>max_osds<span class="o">]]]</span><span class="w"> </span><span class="o">[</span>--no-increasing<span class="o">]</span></span>
</pre></div></div><p>默认情况下，这个命令调整 OSD 的覆盖权重时会选择比平均利用率大或小 20% 的 OSD 们，但是，
可以用 <code class="docutils literal notranslate"><span class="pre">threshold</span></code> 参数指定别的百分比。</p>
<p>要限制 OSD 权重调整的幅度，可以用 <code class="docutils literal notranslate"><span class="pre">max_change</span></code> 参数，
默认为 0.05 。要限制一次可以调整的 OSD 数量，
用 <code class="docutils literal notranslate"><span class="pre">max_osds</span></code> 参数，默认是 4 。
增大这些参数可以加速 OSD 利用率的均衡，
也会潜在地增加对客户端操作的影响，因为会导致的数据挪动更多。</p>
<p>在正式运行 <code class="docutils literal notranslate"><span class="pre">osd</span> <span class="pre">reweight-by-utilization</span></code> 命令前，可以先测试一下。
要想确定调用 <code class="docutils literal notranslate"><span class="pre">osd</span> <span class="pre">reweight-by-utilization</span></code> 命令时哪些以及有多少
PG 和 OSD 会受影响，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>test-reweight-by-utilization<span class="w"> </span><span class="o">[</span>threshold<span class="w"> </span><span class="o">[</span>max_change<span class="w"> </span>max_osds<span class="o">]]</span><span class="w"> </span><span class="o">[</span>--no-increasing<span class="o">]</span></span>
</pre></div></div><p>给 <code class="docutils literal notranslate"><span class="pre">reweight-by-utilization</span></code> 和 <code class="docutils literal notranslate"><span class="pre">test-reweight-by-utilization</span></code> 命令加上 <code class="docutils literal notranslate"><span class="pre">--no-increasing</span></code> 选项可以防止当前 &lt; 1.00000 的覆盖权重被增大。
这个选项在特定环境下有用：比如，
在均衡一个需要急需补救的 <code class="docutils literal notranslate"><span class="pre">full</span></code> 或 <code class="docutils literal notranslate"><span class="pre">nearful</span></code> 的 OSD 时、
或者一些 OSD 正在维修、或者正在慢慢进入工作状态时。</p>
<p>用 Nautilus 或更新版本部署的（或者 Luminous 和 Mimic 的后期修订版）
它们没有 Luminous 之前的客户端，可以转而启用
<code class="docutils literal notranslate"><span class="pre">ceph-mgr</span></code> 的 <cite>balancer</cite> 模块。</p>
<p>黑名单（ blocklist ）是可以更改的，可以增加、删除黑名单里的一个 IP 地址，
或者一个 CIDR 网段。如果一个地址进了黑名单，它将无法连接到任何 OSD 。
如果一个 OSD 包含在一个已被列入黑名单的 IP 地址或 CIDR 范围内，
那么该 OSD 作为客户端时将无法对它的互联 OSD 执行操作：
此类被封禁的操作包括分层（ tiering ）和 copy-from 功能。
要在黑名单中添加或删除 IP 地址、 CIDR 网段，
执行以下命令之一：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>blocklist<span class="w"> </span><span class="o">[</span><span class="s2">&quot;range&quot;</span><span class="o">]</span><span class="w"> </span>add<span class="w"> </span>ADDRESS<span class="o">[</span>:source_port<span class="o">][</span>/netmask_bits<span class="o">]</span><span class="w"> </span><span class="o">[</span>TIME<span class="o">]</span></span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>blocklist<span class="w"> </span><span class="o">[</span><span class="s2">&quot;range&quot;</span><span class="o">]</span><span class="w"> </span>rm<span class="w"> </span>ADDRESS<span class="o">[</span>:source_port<span class="o">][</span>/netmask_bits<span class="o">]</span></span>
</pre></div></div><p>用上面的 <code class="docutils literal notranslate"><span class="pre">add</span></code> 命令加进黑名单的时候，
可以用 <code class="docutils literal notranslate"><span class="pre">TIME</span></code> 关键字指定屏蔽时长（单位为秒），
就是它在黑名单里呆的时间，默认 1 小时。
增加或删除 CIDR 网段时，要加上面命令里的 <code class="docutils literal notranslate"><span class="pre">range</span></code> 关键字。</p>
<p>注意，这些命令主要用于故障测试。
正常情况下，黑名单是系统自动维护的，
不需要任何手动干预。</p>
<p>要创建或删除指定存储池的快照，
执行以下命令之一：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>mksnap<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>snap-name<span class="o">}</span></span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rmsnap<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>snap-name<span class="o">}</span></span>
</pre></div></div><p>创建/删除/重命名指定的存储池，
执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>create<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">[</span>pg_num<span class="w"> </span><span class="o">[</span>pgp_num<span class="o">]]</span></span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>delete<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">[{</span>pool-name<span class="o">}</span><span class="w"> </span>--yes-i-really-really-mean-it<span class="o">]</span></span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rename<span class="w"> </span><span class="o">{</span>old-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>new-name<span class="o">}</span></span>
</pre></div></div><p>更改存储池设置，执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>field<span class="o">}</span><span class="w"> </span><span class="o">{</span>value<span class="o">}</span></span>
</pre></div></div><p>下面是可用的 field 值：</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">size</span></code>: 设置存储池内数据的副本数；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pg_num</span></code>: 归置组数量；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pgp_num</span></code>: 计算归置组存放的有效数量；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">crush_rule</span></code>: 用于归置映射的规则号。</p></li>
</ul>
</div></blockquote>
<p>查看存储池配置值，执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>get<span class="w"> </span><span class="o">{</span>pool-name<span class="o">}</span><span class="w"> </span><span class="o">{</span>field<span class="o">}</span></span>
</pre></div></div><p>可用的 field 值有：</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">pg_num</span></code>: 归置组数量；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pgp_num</span></code>: 计算归置存放时的有效 PG 数量；</p></li>
</ul>
</div></blockquote>
<p>向指定 OSD 或所有 OSD （用 <code class="docutils literal notranslate"><span class="pre">*</span></code> 指定）下达一个洗刷命令，
执行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>scrub<span class="w"> </span><span class="o">{</span>osd-num<span class="o">}</span></span>
</pre></div></div><p>向指定 OSD 或所有 OSD （用 <code class="docutils literal notranslate"><span class="pre">*</span></code> 指定）下达修复命令，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>repair<span class="w"> </span>N</span>
</pre></div></div><p>你可以在指定 OSD 上做个简单的吞吐量压力测试。
此测试每次写入的尺寸是 <code class="docutils literal notranslate"><span class="pre">BYTES_PER_WRITE</span></code> （默认 4 MB ），
增量地写入，一共写入 <code class="docutils literal notranslate"><span class="pre">TOTAL_DATA_BYTES</span></code> （默认 1 GB ）。
此测试没有破坏性，不会覆盖已有的 OSD 数据，
但可能会暂时影响同时访问此 OSD 的客户端性能。
要启动这个压力测试，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>osd.N<span class="w"> </span>bench<span class="w"> </span><span class="o">[</span>TOTAL_DATA_BYTES<span class="o">]</span><span class="w"> </span><span class="o">[</span>BYTES_PER_WRITE<span class="o">]</span></span>
</pre></div></div><p>要清除两次压力测试之间一个指定 OSD 上的缓存，
执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>osd.N<span class="w"> </span>cache<span class="w"> </span>drop</span>
</pre></div></div><p>要查看某一 OSD 缓存的统计信息，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>osd.N<span class="w"> </span>cache<span class="w"> </span>status</span>
</pre></div></div></section>
<section id="mds">
<h2>MDS 子系统<a class="headerlink" href="#mds" title="Permalink to this heading"></a></h2>
<p>一个元数据服务器正在运行时，要想更改它的配置参数，可执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>mds.<span class="o">{</span>mds-id<span class="o">}</span><span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="o">{</span>setting<span class="o">}</span><span class="w"> </span><span class="o">{</span>value<span class="o">}</span></span>
</pre></div></div><p>例如：想要打开调试消息，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>mds.0<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>debug_ms<span class="w"> </span><span class="m">1</span></span>
</pre></div></div><p>要查看所有元数据服务器的状态，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mds<span class="w"> </span>stat</span>
</pre></div></div><p>把活跃的 MDS 标记为失败（是为了触发故障转移到备机，
如果有备机的话），执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mds<span class="w"> </span>fail<span class="w"> </span><span class="m">0</span></span>
</pre></div></div><div class="admonition-todo admonition" id="id6">
<p class="admonition-title">Todo</p>
<p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">mds</span></code> 子命令缺少文档：set, dump, getmap, stop, setmap</p>
</div>
</section>
<section id="id7">
<h2>监视器子系统<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h2>
<p>查看监视器统计信息，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mon<span class="w"> </span>stat</span>
</pre></div></div><p>此命令的输出和下面的内容相似：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">e2</span><span class="p">:</span> <span class="mi">3</span> <span class="n">mons</span> <span class="n">at</span> <span class="p">{</span><span class="n">a</span><span class="o">=</span><span class="mf">127.0.0.1</span><span class="p">:</span><span class="mi">40000</span><span class="o">/</span><span class="mi">0</span><span class="p">,</span><span class="n">b</span><span class="o">=</span><span class="mf">127.0.0.1</span><span class="p">:</span><span class="mi">40001</span><span class="o">/</span><span class="mi">0</span><span class="p">,</span><span class="n">c</span><span class="o">=</span><span class="mf">127.0.0.1</span><span class="p">:</span><span class="mi">40002</span><span class="o">/</span><span class="mi">0</span><span class="p">},</span> <span class="n">election</span> <span class="n">epoch</span> <span class="mi">6</span><span class="p">,</span> <span class="n">quorum</span> <span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span> <span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">,</span><span class="n">c</span>
</pre></div>
</div>
<p>输出的末尾有个 <code class="docutils literal notranslate"><span class="pre">quorum</span></code> 列表，它列出了当前法定人数里的监视器节点。</p>
<p>也可以更直接地获取此信息，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>quorum_status<span class="w"> </span>-f<span class="w"> </span>json-pretty</span>
</pre></div></div><p>此命令的输出形似如下：</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="w">    </span><span class="s2">&quot;election_epoch&quot;</span><span class="o">:</span><span class="w"> </span><span class="mf">6</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;quorum&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">    </span><span class="mf">0</span><span class="p">,</span>
<span class="w">    </span><span class="mf">1</span><span class="p">,</span>
<span class="w">    </span><span class="mf">2</span>
<span class="w">    </span><span class="p">],</span>
<span class="w">    </span><span class="s2">&quot;quorum_names&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">    </span><span class="s2">&quot;a&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;b&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;c&quot;</span>
<span class="w">    </span><span class="p">],</span>
<span class="w">    </span><span class="s2">&quot;quorum_leader_name&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;a&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;monmap&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w">    </span><span class="s2">&quot;epoch&quot;</span><span class="o">:</span><span class="w"> </span><span class="mf">2</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;fsid&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;ba807e74-b64f-4b72-b43f-597dfe60ddbc&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;modified&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;2016-12-26 14:42:09.288066&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;created&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;2016-12-26 14:42:03.573585&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="s2">&quot;features&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w">        </span><span class="s2">&quot;persistent&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">        </span><span class="s2">&quot;kraken&quot;</span>
<span class="w">        </span><span class="p">],</span>
<span class="w">        </span><span class="s2">&quot;optional&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">[]</span>
<span class="w">    </span><span class="p">},</span>
<span class="w">    </span><span class="s2">&quot;mons&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">        </span><span class="s2">&quot;rank&quot;</span><span class="o">:</span><span class="w"> </span><span class="mf">0</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;name&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;a&quot;</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;addr&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;127.0.0.1:40000\/0&quot;</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;public_addr&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;127.0.0.1:40000\/0&quot;</span>
<span class="w">        </span><span class="p">},</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">        </span><span class="s2">&quot;rank&quot;</span><span class="o">:</span><span class="w"> </span><span class="mf">1</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;name&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;b&quot;</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;addr&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;127.0.0.1:40001\/0&quot;</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;public_addr&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;127.0.0.1:40001\/0&quot;</span>
<span class="w">        </span><span class="p">},</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">        </span><span class="s2">&quot;rank&quot;</span><span class="o">:</span><span class="w"> </span><span class="mf">2</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;name&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;c&quot;</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;addr&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;127.0.0.1:40002\/0&quot;</span><span class="p">,</span>
<span class="w">        </span><span class="s2">&quot;public_addr&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;127.0.0.1:40002\/0&quot;</span>
<span class="w">        </span><span class="p">}</span>
<span class="w">    </span><span class="p">]</span>
<span class="w">    </span><span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>如果法定人数未形成，上述命令会一直等待。</p>
<p>只看单个监视器的状态，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>mon.<span class="o">[</span>name<span class="o">]</span><span class="w"> </span>mon_status</span>
</pre></div></div><p>其中， <code class="docutils literal notranslate"><span class="pre">[name]</span></code> 的值可以从
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">quorum_status</span></code> 命令的输出里找到，
此命令的输出样本：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;b&quot;</span><span class="p">,</span>
    <span class="s2">&quot;rank&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
    <span class="s2">&quot;state&quot;</span><span class="p">:</span> <span class="s2">&quot;peon&quot;</span><span class="p">,</span>
    <span class="s2">&quot;election_epoch&quot;</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span>
    <span class="s2">&quot;quorum&quot;</span><span class="p">:</span> <span class="p">[</span>
    <span class="mi">0</span><span class="p">,</span>
    <span class="mi">1</span><span class="p">,</span>
    <span class="mi">2</span>
    <span class="p">],</span>
    <span class="s2">&quot;features&quot;</span><span class="p">:</span> <span class="p">{</span>
    <span class="s2">&quot;required_con&quot;</span><span class="p">:</span> <span class="s2">&quot;9025616074522624&quot;</span><span class="p">,</span>
    <span class="s2">&quot;required_mon&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="s2">&quot;kraken&quot;</span>
    <span class="p">],</span>
    <span class="s2">&quot;quorum_con&quot;</span><span class="p">:</span> <span class="s2">&quot;1152921504336314367&quot;</span><span class="p">,</span>
    <span class="s2">&quot;quorum_mon&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="s2">&quot;kraken&quot;</span>
    <span class="p">]</span>
    <span class="p">},</span>
    <span class="s2">&quot;outside_quorum&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;extra_probe_peers&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;sync_provider&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;monmap&quot;</span><span class="p">:</span> <span class="p">{</span>
    <span class="s2">&quot;epoch&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
    <span class="s2">&quot;fsid&quot;</span><span class="p">:</span> <span class="s2">&quot;ba807e74-b64f-4b72-b43f-597dfe60ddbc&quot;</span><span class="p">,</span>
    <span class="s2">&quot;modified&quot;</span><span class="p">:</span> <span class="s2">&quot;2016-12-26 14:42:09.288066&quot;</span><span class="p">,</span>
    <span class="s2">&quot;created&quot;</span><span class="p">:</span> <span class="s2">&quot;2016-12-26 14:42:03.573585&quot;</span><span class="p">,</span>
    <span class="s2">&quot;features&quot;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s2">&quot;persistent&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="s2">&quot;kraken&quot;</span>
        <span class="p">],</span>
        <span class="s2">&quot;optional&quot;</span><span class="p">:</span> <span class="p">[]</span>
    <span class="p">},</span>
    <span class="s2">&quot;mons&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="p">{</span>
        <span class="s2">&quot;rank&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;a&quot;</span><span class="p">,</span>
        <span class="s2">&quot;addr&quot;</span><span class="p">:</span> <span class="s2">&quot;127.0.0.1:40000\/0&quot;</span><span class="p">,</span>
        <span class="s2">&quot;public_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;127.0.0.1:40000\/0&quot;</span>
        <span class="p">},</span>
        <span class="p">{</span>
        <span class="s2">&quot;rank&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;b&quot;</span><span class="p">,</span>
        <span class="s2">&quot;addr&quot;</span><span class="p">:</span> <span class="s2">&quot;127.0.0.1:40001\/0&quot;</span><span class="p">,</span>
        <span class="s2">&quot;public_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;127.0.0.1:40001\/0&quot;</span>
        <span class="p">},</span>
        <span class="p">{</span>
        <span class="s2">&quot;rank&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
        <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;c&quot;</span><span class="p">,</span>
        <span class="s2">&quot;addr&quot;</span><span class="p">:</span> <span class="s2">&quot;127.0.0.1:40002\/0&quot;</span><span class="p">,</span>
        <span class="s2">&quot;public_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;127.0.0.1:40002\/0&quot;</span>
        <span class="p">}</span>
    <span class="p">]</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>要看看监视器状态的一个转储，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mon<span class="w"> </span>dump</span>
</pre></div></div><p>此命令的输出和如下内容相似：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dumped</span> <span class="n">monmap</span> <span class="n">epoch</span> <span class="mi">2</span>
<span class="n">epoch</span> <span class="mi">2</span>
<span class="n">fsid</span> <span class="n">ba807e74</span><span class="o">-</span><span class="n">b64f</span><span class="o">-</span><span class="mi">4</span><span class="n">b72</span><span class="o">-</span><span class="n">b43f</span><span class="o">-</span><span class="mi">597</span><span class="n">dfe60ddbc</span>
<span class="n">last_changed</span> <span class="mi">2016</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">14</span><span class="p">:</span><span class="mi">42</span><span class="p">:</span><span class="mf">09.288066</span>
<span class="n">created</span> <span class="mi">2016</span><span class="o">-</span><span class="mi">12</span><span class="o">-</span><span class="mi">26</span> <span class="mi">14</span><span class="p">:</span><span class="mi">42</span><span class="p">:</span><span class="mf">03.573585</span>
<span class="mi">0</span><span class="p">:</span> <span class="mf">127.0.0.1</span><span class="p">:</span><span class="mi">40000</span><span class="o">/</span><span class="mi">0</span> <span class="n">mon</span><span class="o">.</span><span class="n">a</span>
<span class="mi">1</span><span class="p">:</span> <span class="mf">127.0.0.1</span><span class="p">:</span><span class="mi">40001</span><span class="o">/</span><span class="mi">0</span> <span class="n">mon</span><span class="o">.</span><span class="n">b</span>
<span class="mi">2</span><span class="p">:</span> <span class="mf">127.0.0.1</span><span class="p">:</span><span class="mi">40002</span><span class="o">/</span><span class="mi">0</span> <span class="n">mon</span><span class="o">.</span><span class="n">c</span>
</pre></div>
</div>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../bluestore-migration/" class="btn btn-neutral float-left" title="迁移到 BlueStore" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../../troubleshooting/community/" class="btn btn-neutral float-right" title="Ceph 社区" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>